package info.touret.winecellar.dao.server;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import java.util.logging.Logger;

/**
 * Created by IntelliJ IDEA.
 * User: touret-a
 * Date: 25/05/11
 * Time: 15:41
 * To change this template use File | Settings | File Templates.
 */
public class TraceEnabledInterceptor implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        Logger trace = Logger.getLogger(invocation.getThis().getClass().getCanonicalName());
        trace.finest("invocation de la methode :" + invocation.getMethod().getName());
        trace.finest("parametres:"+invocation.getArguments());
        return invocation.proceed();
    }
}
